* (Disadvantage is potentially greater internal fragmentation).
*/
+#include <xen/config.h>
#include <xen/mm.h>
#include <xen/spinlock.h>
#include <xen/ac_timer.h>
#include <xen/cache.h>
+#include <xen/prefetch.h>
static LIST_HEAD(freelist);
static spinlock_t freelist_lock = SPIN_LOCK_UNLOCKED;
#include <xen/config.h>
#include <xen/list.h>
-#include <xen/spinlock.h>
-#include <xen/perfc.h>
-#include <xen/sched.h>
-
-#include <asm/processor.h>
-#include <asm/atomic.h>
-#include <asm/desc.h>
-#include <asm/flushtlb.h>
#include <asm/io.h>
-#include <asm/uaccess.h>
-
-#include <public/xen.h>
/*
* Per-page-frame information.
*/
#define __phys_to_machine_mapping ((unsigned long *)RO_MPT_VIRT_START)
-/* Returns the machine physical */
-static inline unsigned long phys_to_machine_mapping(unsigned long pfn)
-{
- unsigned long mfn;
- l1_pgentry_t pte;
-
- if (__get_user(l1_pgentry_val(pte), (__phys_to_machine_mapping + pfn)))
- mfn = 0;
- else
- mfn = l1_pgentry_to_phys(pte) >> PAGE_SHIFT;
-
- return mfn;
-}
+#define phys_to_machine_mapping(_pfn) \
+({ l1_pgentry_t l1e; unsigned long mfn; \
+ mfn = __get_user(l1_pgentry_val(l1e), &__phys_to_machine_mapping[_pfn]) \
+ ? 0 : l1_pgentry_to_pfn(l1e); \
+ mfn; })
#define set_machinetophys(_mfn, _pfn) machine_to_phys_mapping[(_mfn)] = (_pfn)
#define DEFAULT_GDT_ENTRIES (LAST_RESERVED_GDT_ENTRY+1)
void propagate_page_fault(unsigned long addr, u16 error_code);
-/* update_grant_va_mapping
- * Caller must own d's BIGLOCK, is responsible for flushing the TLB,
- * and have already get_page'd */
+/*
+ * Caller must own d's BIGLOCK, is responsible for flushing the TLB, and must
+ * hold a reference to the page.
+ */
int update_grant_va_mapping(unsigned long va,
unsigned long val,
struct domain *d,
struct arch_exec_domain arch;
};
-/*
-** SMH: do_mmu_update() grabs big_lock and subsequently can fault
-** on map_ldt_shadow_page(), enter do_page_fault() and then deadlock
-** trying to reacquire big_lock. A temporary fix is to make big_lock
-** recursive; overall probably needs more thought.
-*/
-#if 0
-#define LOCK_BIGLOCK(_d) spin_lock(&(_d)->big_lock)
-#define UNLOCK_BIGLOCK(_d) spin_unlock(&(_d)->big_lock)
-#else
+/* Per-domain lock can be recursively acquired in fault handlers. */
#define LOCK_BIGLOCK(_d) spin_lock_recursive(&(_d)->big_lock)
#define UNLOCK_BIGLOCK(_d) spin_unlock_recursive(&(_d)->big_lock)
-#endif
struct domain
{